home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Snippets / Development Tools & Languages / AEGestalt 1.0 / UAEGestalt.cp < prev    next >
Encoding:
Text File  |  1992-07-15  |  1.9 KB  |  80 lines  |  [TEXT/MPS ]

  1. //     UAEGestalt.cp 
  2. //     Copyright © 1991-92 by Apple Computer, Inc. All rights reserved.
  3. //    Kent Sandvik DTS
  4. //    This file contains the basic TAEApplication member functions
  5. //
  6. //    <1>        khs        1.0        First final version
  7.  
  8.  
  9. // INCLUDES 
  10.  
  11. #ifndef __AEGESTALT__
  12. #include "UAEGestalt.h"                                        
  13. #endif
  14.  
  15. // TAEApplication
  16. //    Empty constructor - for avoiding ptabs in global data space
  17. #pragma segment ARes
  18. TAEApplication::TAEApplication()
  19. {
  20. }
  21.  
  22. //    Initialize the Application object
  23.  
  24. #pragma segment AInit
  25. pascal void TAEApplication::IAEApplication(OSType fileType,
  26.                                            OSType creator)
  27. {
  28.     inherited::IApplication(fileType, creator);
  29.  
  30.     if (gDeadStripSuppression)
  31.     {
  32.         // so the linker doesn't dead strip class info 
  33.         macroDontDeadStrip(TLabelView);
  34.         macroDontDeadStrip(TInformationView);
  35.         macroDontDeadStrip(TGrayFill);
  36.     }
  37.     // register adorner types
  38.     RegisterStdType("TGrayFill", 'gray');
  39. }
  40.  
  41.  
  42. //    Create a new TDocument from the class
  43. #pragma segment AOpen
  44. pascal TDocument* TAEApplication::DoMakeDocument(CommandNumber/* itsCmdNumber */,
  45.                                                  TFile*/* itsFile */ )
  46. {
  47.     TAEDocument * aAEDocument = new TAEDocument;
  48.     aAEDocument->IAEDocument();
  49.     return aAEDocument;
  50. }
  51.  
  52.  
  53. //    Handle incoming AppleEvents calls, in our case to the TAEServerCommand
  54. #pragma segment ASelCommand
  55. pascal void TAEApplication::DoAppleCommand(CommandNumber theNumber,
  56.                                            const AppleEvent& message,
  57.                                            const AppleEvent& reply)
  58. {
  59.     switch (theNumber)
  60.     {
  61.             // case Gestalt server AE, create a command from the AE, and post it!
  62.         case cAEProvideGestaltInfo:
  63.             TAEServerCommand * aCommand = new TAEServerCommand;
  64.             aCommand->InitializeFromAppleEvent(theNumber, this, kCantUndo, kDoesNotCauseChange, NULL, message, reply);
  65.             this->PostAnEvent(aCommand);
  66.             break;
  67.  
  68.         default:
  69.             inherited::DoAppleCommand(theNumber, message, reply);
  70.     }
  71. }
  72.  
  73.  
  74. // Show our cute About Box with Jeff trying to destroy my portable back home
  75. #pragma segment ARes
  76. pascal void TAEApplication::DoAboutBox()
  77. {
  78.     CreateAboutBox();
  79. }
  80.